<?php

require_once dirname(__FILE__) . '/LiteTest.php';

class LiteTestUnitLoader extends Lite_Loader_AbstractLoader {

	/**
	 * @var Loader
	 */
	private $liteLoader;

	function __construct(){
		$this->liteLoader = new Lite_Loader_LiteLoader();
	}

	/**
	 * @param unknown_type $name
	 */
	public function getFilePath($name){
		if('Test' == substr($name, -4)) {
			$path = LiteString::toString($this->liteLoader->getFilePath($name));
			return $path->replace(LITE_DIRECTORY, LITE_TEST_DIRECTORY);
		}
	}
}

/**
 * Static test suite.
 */
class LiteTestSuite extends PHPUnit_Framework_TestSuite {

	/**
	 * Constructs the test suite handler.
	 */
	public function __construct(){
		$this->setName(get_class($this));
		
		LiteClassLoader::registerAutoloader(new LiteTestUnitLoader());
		
		$tests = array(
			'Lite_LiteUrlTest'
		);
		
		foreach($tests as $class) {
			$this->addTestSuite($class);
		}
	}

	/**
	 * Creates the suite.
	 */
	public static function suite(){
		return new self();
	}
}

